package jiekou;

import java.util.ArrayList;

public class fangan2 implements Studentjiekou{
    @Override
    public void test1(ArrayList<Students> students) {
        System.out.println("------学生的全部信息-------------");
        int cout=0;
        int cout1=0;
        for (int i = 0; i < students.size(); i++) {
            System.out.println("姓名："+students.get(i).getName()+"性别"+students.get(i).getSex()+"成绩"+students.get(i).getScore());
            if (students.get(i).getSex() == "女") {
                cout++;

            }else {
                cout1++;
            }
        }
        System.out.println("男生人数："+cout1);
        System.out.println("女生人数："+cout);
        System.out.println("---------------------------------");
    }
    @Override
    public void test2(ArrayList<Students> students) {
        double sum=0.0 ;
        double max=students.get(0).getScore();
        double min=students.get(0).getScore();
        for (int i = 0; i < students.size(); i++) {
            sum +=students.get(i).getScore();
            if (min>students.get(i).getScore()) {
                min=students.get(i).getScore();

            } else if (max<students.get(i).getScore()) {
                max=students.get(i).getScore();

            }
        }
        System.out.println(max);
        System.out.println(min);
        System.out.println("学生的平均成绩是："+(sum-max-min)/students.size());

    }
}
